//
//  NSString+YC.h
//  YCSchool
//
//  Created by yanglinxia on 16/4/26.
//  Copyright © 2016年 yanglinxia. All rights reserved.
//

#import <Foundation/Foundation.h>
#import <CommonCrypto/CommonDigest.h>

@interface NSString (YC)


/**
 *  清除字符串两边的空白
 *
 *  @return 清除之后的字符串
 */
- (NSString *)yc_trimString;

/**
 *  判断当前应用是否支持url
 *
 *  @return 支持 YES，不支持 NO
 */
- (BOOL)yc_canOpenURL;

/**
 *  打开当前url
 *
 *  @return 打开是否成功
 */
- (BOOL)yc_openURL;

/**
 *  字符串转换为NSDate
 *
 *  @param formatString 日期格式化字符串
 *
 *  @return 日期
 */
- (NSDate *)yc_dateWithDateFormatString:(NSString *)formatString;

// 返回文本的size
- (CGSize)yc_sizeWithFont:(UIFont *)font MaxSize:(CGSize)size;//maxSize为在这范围内计算


- (NSString *)yc_md5String;

- (NSUInteger)yc_wordCount;

- (NSString *)yc_paramOfName:(NSString *)paramName;

- (NSString *)yc_stringOfHexString;

- (NSString *)yc_hexString;

- (NSData *)yc_dataUsingHexEncoding;

- (NSString *)yc_urlEncodeString;

- (NSString *)yc_decrypt3DESWithKey:(NSString *)key IV:(NSString *)iv;

- (NSString *)yc_encrypt3DESWithKey:(NSString *)key IV:(NSString *)iv;

- (id)yc_JSONObject;

- (NSDictionary *)yc_PINYINInfo;

/** 生成唯一字符串 */
+ (NSString *)yc_guidString;

- (NSString *)yc_RSADecryptWithPublicKeyRef:(SecKeyRef)keyRef;

- (NSString *)yc_RSAEncryptWithPublicKeyRef:(SecKeyRef)keyRef;

- (NSString *)yc_AES256EncryptWithKey:(NSString *)key;

- (NSString *)yc_AES256DecryptWithKey:(NSString *)key;

- (NSString *)yc_urlStringWithParams:(NSDictionary *)params;

#pragma mark - New

///返回星座:根据月日
+ (NSString *)yc_getAstroWithMonth:(NSInteger)month day:(NSInteger)day;

/// 在前面拼接baseUrl
- (NSString *)appendBaseUrl;

/// 图片加密转字符串
+ (NSString *)yc_stringWithBase64FromUIImage:(UIImage *)image;

/**  验证是否是手机号 */
- (BOOL)validateMobile;

/**  验证是否是身份证号 */
- (BOOL)validateIdentityCard;

/**  验证是否是QQ号 */
- (BOOL)validateQQ;

/**  验证是否是url */
- (BOOL)validateUrl;

/**  验证是否是邮箱 */
- (BOOL)validateEmail;

/** 车牌号验证 */
+ (BOOL)validateCarNo;


@end
